#include"BirdImpluse.h"
#include"LSYEasyBody.h"
#include"LSYEasyWorld.h"
#include"Box2D/Box2D.h"
#include"BirdImspluseContactListener.h"
#include"BirdThrower.h"
#include"Tool.h"

USING_NS_CC;

bool BirdImpluse::init()
{
	if (AbstractLayer::init(b2Vec2(0, -10)))
	{
		return true;
	}
	return false;
}

void BirdImpluse::box2DAppReady()
{
	auto size = Director::getInstance()->getWinSize();
	LSYEasyBody::createRectangle(b2Vec2(0, 0), size.width, size.height);
	stone = LSYEasyBody::createBox(b2Vec2(400, 370), b2Vec2(20, 40));
	b2PolygonShape* shape = new b2PolygonShape;
	shape->SetAsBox(20, 40, b2Vec2(0,40), 0);
	stone->CreateFixture(shape, 1);
	shape->SetAsBox(20, 40, b2Vec2(0,80), 0);
	stone->CreateFixture(shape, 1);
	shape->SetAsBox(20, 40, b2Vec2(0, 120), 0);
	stone->CreateFixture(shape, 1);
	
	bird = LSYEasyBody::createBox(b2Vec2(250, 100), b2Vec2(20, 20));
	bird->SetBullet(true);
	
	listener = new BirdImpluseContactListener(this);
	pWorld->SetContactListener(listener);
	
	/*birdManager = new BirdThrower(this, bird, b2Vec2(100, 300));*/
}

bool BirdImpluse::onTouchBegan(cocos2d::Touch * touch, cocos2d::Event * unused_event)
{
	return false;
}

void BirdImpluse::onTouchEnded(cocos2d::Touch * touch, cocos2d::Event * unused_event)
{
}

void BirdImpluse::onTouchMoved(cocos2d::Touch * touch, cocos2d::Event * unused_event)
{
}

void BirdImpluse::update(float dt)
{
}
